
import React, { Component } from 'react';
import {
	StyleSheet, Text, View, TouchableOpacity, Image, FlatList, TextInput, Alert,ScrollView
} from "react-native";
import { GLOBAL } from '../../../config/global';
import { PageStatusIndex } from '../../../component/page-status/PageStatusIndex';
import { API, API_GENERATE } from '../../../config/api';
import HTTP from '../../../utils/http';
import { style } from '../../../theme/style';
import { Common } from '../../../component/common/Common.js';
// import { ScrollView } from 'react-navigation';

export class test extends Component {
	static navigationOptions = ({ navigation, navigationOptions }) => {
		return {
      headerTitle: '测试',
      headerTintColor: style.color.white,
      headerLeft: <Common type="headLeft" onPress={() => { navigation.goBack() }} color='#fff' />,
      headerRight: (<Image style={style.head.headRightEmpty} source={require('../../../imgs/goBackEmpty.png')} />),
      headerStyle: {  // 头部整体样式 
        elevation: 0,
        borderBottomWidth: 0,
        backgroundColor: style.color.themeColor
      },
      headerTitleStyle: {
        flex: 1,
        textAlign: 'center'
      }
    }
	};

	constructor(props) {
    super(props);
		this.state = {
			listData:[]
    }
    this.totalPage=1
    this.dateObj={"companyId":"04929baa193d46e0ad7c822d3608f8dc","pageNo":1,"pageSize":10,"corpType":"1"}
	}

	async componentWillMount() {
    this.initDate()
  }
  loadMore() {
		if (this.totalPage > this.dateObj.pageNo) {
			this.dateObj.pageNo++;
			this.initDate();
		}
  }
  async initDate() {
    
  }
	// 列表
	_renderListItem = (data) => {
		return (
				<View style={{ backgroundColor: 'green',height:80,borderBottomWidth:1,borderBottomColor:'#000'}}>
          <Text>{data.item.operateTypeName}</Text>
        </View>
		)
	}

	render() {
    let {listData} = this.state
		return (
      <ScrollView stickyHeaderIndices={[1]}>
        <View style={{height:200,backgroundColor: style.color.themeColor}}>
        </View>
        <View style={{height:100,backgroundColor: 'red'}}>
        </View>
        <View styles={{flex:1}}>
          <FlatList 
            maxHeight={800}
            data={listData}
            renderItem={this._renderListItem}
            onEndReachedThreshold={0.1}
            onEndReached={() => { this.loadMore() }}
          />
        </View>
        
      </ScrollView>
    )
	}
}

const styles = StyleSheet.create({
	container: {
		flex: 1,
		backgroundColor: style.color.bgGray,
	},
})